package JasPerl::JspFactory;

use strict;
use warnings;

use JasPerl::PageContext;

my $DEFAULT_FACTORY = JasPerl::JspFactory->new;

sub new {
    my $class = shift;
    bless { }, $class;
}

sub get_default_factory {
    return $DEFAULT_FACTORY;
}

sub set_default_factory {
    my ($class, $factory) = @_;
    $DEFAULT_FACTORY = $factory;
}

sub get_jsp_application_context {
}

sub get_page_context {
    my ($self, @args) = @_;

    # TODO: cache/recycle page context?
    my $context = JasPerl::PageContext->new();
    $context->init(@args);
    return $context;
}

sub release_page_context {
    my ($self, $context) = @_;
    $context->release() if $context;
}

1;
